package com.cloud.poetry.system.listener;

import com.cloud.poetry.base.anno.DataSource;
import com.cloud.poetry.base.entity.po.ChatLog;
import com.cloud.poetry.core.constant.DataSourceEnum;
import com.cloud.poetry.system.listener.mapper.ChatLogMapper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author mengxj
 */
@RestController
@RequestMapping("chat")
public class ChatLogListener {

    @Resource
    private ChatLogMapper chatLogMapper;

    @DataSource(DataSourceEnum.SECOND)
    @PostMapping("saveChatLog")
    public void saveChatLog(@RequestBody ChatLog chatLog){
        this.chatLogMapper.insert(chatLog);
    }
}
